<template>
  <div id="app">
    <router-view class="main" />
    <van-tabbar v-model="active" route :fixed="false" v-show="!hideNav">
      <van-tabbar-item icon="home-o" :to="{ name: 'Home' }"
        >首页</van-tabbar-item
      >
      <van-tabbar-item icon="fire-o" :to="{ name: 'Zixun' }"
        >资讯</van-tabbar-item
      >
      <van-tabbar-item icon="cart-o" :to="{ name: 'Cart' }"
        >购物车</van-tabbar-item
      >
      <van-tabbar-item icon="friends-o" :to="{ name: 'User' }"
        >我的</van-tabbar-item
      >
    </van-tabbar>
  </div>
</template>
<script>
export default {
  data() {
    return {
      active: 1,
      hideNav: false,
    };
  },
  watch: {
    $route(v) {
      if (v.meta.isHideNav) {
        this.hideNav = true;
      } else {
        this.hideNav = false;
      }
    },
  },
};
</script>

<style>
html,
body,
#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#app {
  display: flex;
  flex-direction: column;
}
.main {
  flex: 1;
  overflow: auto;
}
img {
  max-width: 100%;
}
</style>

